<?php
/**
 * 	Bushido
 *
 * @category   Bushido
 * @package    Bushido_FusionCharts
 * @subpackage Theme
 * @copyright  Copyright (c) 2008-2009 Nathan Keyes
 * @author Nathan Keyes
 * @version    $Id: KRIDial.php 7 2009-11-14 22:42:08Z nkeyes $
 */


/**
 * 
 * @author Nathan Keyes
 *
 */
class Bushido_FusionCharts_Theme_KRIDial extends Bushido_FusionCharts_Theme_MultiSeries
{

	
	/**
	 * 
	 * @return void
	 */
	public function __construct()
	{
		parent::__construct();
		$this->name = 'KRIDial';
		$this->chartType = Bushido_FusionCharts::ANGUAR_GAGUE;
	}
	
	
	/**
	 * (non-PHPdoc)
	 * @see library/Bushido/FusionCharts/Theme/Bushido_FusionCharts_Theme_MultiSeries#getDataSetNode()
	 */
	public function getDataSetNode($name)
	{
		return "<dials />";	
	}
	
	
	/**
	 * (non-PHPdoc)
	 * @see library/Bushido/FusionCharts/Theme/Bushido_FusionCharts_Theme_MultiSeries#getDataNode()
	 */
	public function getDataNode($label, $value)
	{
		$toolText = $label . '<br />' . $this->_getStatusLabel($value);
		$toolText = htmlentities($toolText);
		
		$value = $value >= 0 ? $value : 100;
		$setNode =  "<dial id='Dial1' toolText='$toolText' value='$value' baseWidth='6' topWidth='1' showValue='1' rearExtension='10' valueY='200'/>";
		return $setNode;
	}
	
	/**
	 * 
	 * @param $value
	 * @return string
	 */
	protected function _getStatusLabel($value)
	{
		if($value > 66.667)
		{
			return 'High';
		}
		elseif($value > 33.333)
		{
			return 'Medium';
		}
		elseif($value >= 0)
		{
			return 'Low';
		}
		else
		{
			return 'NO DATA';
		}
	}

}
